const express = require('express');
const router = express.Router();
const db = require('../config/db');

// 商品详情
router.post('/', (req, res) => {
    const { id } = req.body;
    const sql = 'SELECT * FROM detail WHERE id = ?';
    db.query(sql, [id], (err, result) => {
        if (err) {
            res.send({
                success: "失败",
                msg: "false",
                err: err.message
            });
        } else {
            res.send({
                success: "成功",
                msg: "true",
                result: result
            });
        }
    });
});

module.exports = router;